
#pragma once

#include <windows.h>
#include <commctrl.h>
class CWindow
{	
public:
	CWindow();
	CWindow( HWND hWnd );
	CWindow& operator=( HWND hWnd );
	void Attach( HWND hWnd );
	void ShowWindow( BOOL bShow );
	HWND GetDlgItem( UINT idd );
	LRESULT SendMessage( UINT msg,WPARAM wParam,LPARAM lParam );
	
	HWND m_hWnd;
};

class CListCtrlWindow:public CWindow
{
public:
	CListCtrlWindow();

	void LVM_InsertItem( int nItem,const char* lpszItem );
	void LVM_InsertCol( int index,const char* head,int width);
	void LVM_SetItemText( int iItem,int iSubItem,const char* lpszText );
	void LVM_GetItemText( int iItem,int iSubItem,char* szBuf,int nLen );

};

class CTreeViewCtrl:public CWindow
{
public:
	CTreeViewCtrl();
	HTREEITEM InsertItem( LPCTSTR lpszItem,HTREEITEM hParent = TVI_ROOT,HTREEITEM hInsertAfter = TVI_LAST );
	HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const;
	HTREEITEM GetChildItem(HTREEITEM hItem) const;
	HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const;
	HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const;
	HTREEITEM GetParentItem(HTREEITEM hItem) const;
	HTREEITEM GetFirstVisibleItem() const;
	HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const;
	HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const;
	HTREEITEM GetLastVisibleItem() const;
	HTREEITEM GetSelectedItem() const;
	HTREEITEM HitTest(POINT pt, UINT* pFlags) const;
	BOOL	  GetCheck(HTREEITEM hItem) const;
	BOOL	  SetCheck(HTREEITEM hItem, BOOL fCheck);
	BOOL	  SetItemText(HTREEITEM hItem, LPCTSTR lpszItem);
	BOOL	DeleteItem(HTREEITEM hItem);
	BOOL	DeleteAllItems();
	BOOL	Expand(HTREEITEM hItem, UINT nCode);
	BOOL	ExpandTree( HTREEITEM hItem,UINT nCode );
	void	GetItemText(HTREEITEM hItem,char* text,int nLen ) const;
	HTREEITEM GetRootItem() const;
	BOOL	SetItemData(HTREEITEM hItem, DWORD_PTR dwData);
	void	GetItemData(HTREEITEM hItem,DWORD*pdwData ) const;
};

class CDialogBox:public CWindow
{
public:
	BOOL Create( HINSTANCE hInst,UINT idd,HWND hParent,DLGPROC dlgProc );
	int DoModal( HINSTANCE hInst,UINT idd,HWND hParent,DLGPROC dlgProc );
};


